package com.authine.cloudpivot.ext.enums.order;

import java.util.Arrays;
import java.util.List;

/**
 * 退货商品状态
 *
 * @author 张天赐
 */
public enum OrderGoodsReturnsStatusEnum {

    /**
     * 订单商品售后状态
     */
    Approving("审批中"),//审批中暂未使用，被拆成待客服审批、待供应商审批、待财务确认
    ReturnPending("未退货"),
    ReturnedDoneDelivery("已发退货"),
    PendingMiddlemanConfirm("待客服审批"),
    PendingVendorConfirm("待供应商审批"),
    PendingFinanceConfirm("待财务确认"),
    Done("已完成"),
    Closed("已关闭");
    public String des;

    OrderGoodsReturnsStatusEnum(String des) {
        this.des = des;
    }

    /**
     * 进行中的状态集合
     * @return
     */
    public static List<String> getProgressStatus() {
        return Arrays.asList(
                OrderGoodsReturnsStatusEnum.Approving.name(),
                OrderGoodsReturnsStatusEnum.ReturnPending.name(),
                OrderGoodsReturnsStatusEnum.ReturnedDoneDelivery.name(),
                OrderGoodsReturnsStatusEnum.PendingMiddlemanConfirm.name(),
                OrderGoodsReturnsStatusEnum.PendingVendorConfirm.name(),
                OrderGoodsReturnsStatusEnum.PendingFinanceConfirm.name()
        );
    }

    public static List<String> getNormalStatus() {
        return Arrays.asList(
                OrderGoodsReturnsStatusEnum.Approving.name(),
                OrderGoodsReturnsStatusEnum.ReturnPending.name(),
                OrderGoodsReturnsStatusEnum.ReturnedDoneDelivery.name(),
                OrderGoodsReturnsStatusEnum.PendingMiddlemanConfirm.name(),
                OrderGoodsReturnsStatusEnum.PendingVendorConfirm.name(),
                OrderGoodsReturnsStatusEnum.PendingFinanceConfirm.name(),
                OrderGoodsReturnsStatusEnum.Done.name()
        );
    }

    public static OrderGoodsReturnsStatusEnum switchNew(Integer status, Integer goodsStatus) {
        if (goodsStatus.equals(6)) {
            return OrderGoodsReturnsStatusEnum.ReturnPending;
        }
        if (status.equals(6) || status.equals(1) || status.equals(2)) {
            return OrderGoodsReturnsStatusEnum.Approving;
        }

        if (status.equals(3) || status.equals(4)) {
            return OrderGoodsReturnsStatusEnum.ReturnedDoneDelivery;
        }

        if (status.equals(5) || status.equals(7)) {
            return OrderGoodsReturnsStatusEnum.Done;
        }

        return null;
    }
}
